package com.app.constant;


import com.app.BuildConfig;

import java.util.HashMap;
import java.util.Map;

public final class Constants {

    /**
     * 是否是测试环境
     */
    public static final boolean DEBUG = BuildConfig.DEBUG;
    /**
     * 是否打印日志
     */
    public static final boolean PRINT_LOG = DEBUG;

    public static final String IMAGE_FILE_SUFFIX = ".jpeg";
    public static final String IMAGE_GIF_SUFFIX = ".gif";
    public static final String VIDEO_FILE_SUFFIX = ".mp4";
    public static final String AUDIO_FILE_SUFFIX = ".amr";
    public static final String TEXT_FILE_SUFFIX = ".txt";
    public static final String SEPERATOR = "0xd733480";

    /**
     * 性别男
     */
    public static final int MALE = 1;

    /**
     * 性别女
     */
    public static final int FEMALE = 0;

    /**
     * 个人账户
     */
    public static final int PERSONAL_ACCOUNT = 1;

    /**
     * 商业账户
     */
    public static final int BUSINESS_ACCOUNT = 2;

    /**
     * 认证资料审核中
     */
    public static final int AUTH_INFO_CHECKING = 0;
    /**
     * 认证资料通过审核
     */
    public static final int AUTH_INFO_PASSED = 1;
    /**
     * 认证资料未通过审核
     */
    public static final int AUTH_INFO_FAILED = 2;

    public static final Map<Integer, String> ERROR_MAP = new EmptyMap();
    //public static final Map<Integer, String> ERROR_MAP = new HashMap<>();
    public static final int ERROR_CODE_TIMED_OUT = -3;
    public static final int ERROR_CODE_NETWORK_UNREACHABLE = -2;
    // 兼容旧版
    public static final HashMap<Integer, String> ERROR_MAP1 = (HashMap<Integer, String>) ((HashMap) ERROR_MAP).clone();

    /**
     * 网络请求成功code
     */
    public final static int CODE_SUCCESS = 200;
    /**
     * 用户未登录
     */
    public static final int USER_IS_NOT_LOGIN = 110002;
    /**
     * token失效
     */
    public static final int TOKEN_INVALIDATION = 110001;
    /**
     * 完善资料
     */
    public static final int ORGANIZING_DATA = 100027;
    /**
     * 个人认证失败
     */
    public static final int PERSION_AUTH_FAIL = 80000;
    /**
     * 认证时拿不到公安留底照片
     */
    public static final int PERSION_AUTH_PSB_FAIL = 82034;
    /**
     * 列表页数量
     */
    public static final int PAGE_COUNT = 2;
    public static final int PAGE_COUNT_PRUSE = 3;
    public static int COUPON_STATUS_USED = 2; // 已使用
    /**
     * 领取来源1 消息，2 朋友圈  3 活动
     */
    public static int source;

    static {
        ERROR_MAP.put(-5, "连接不到服务器");
        ERROR_MAP.put(-4, "请求结果解析错误");
        ERROR_MAP.put(-3, "网络连接超时");
        ERROR_MAP.put(-2, "未检测到网络连接");
        ERROR_MAP.put(-1, "请求错误");
        ERROR_MAP.put(1, "用户未登录");
        ERROR_MAP.put(2, "服务器繁忙，请稍后再试");
        ERROR_MAP.put(3, "请求参数错误");
        ERROR_MAP.put(4, "手机号码格式错误");
        ERROR_MAP.put(5, "手机号码已被注册");
        ERROR_MAP.put(6, "验证码获取失败");
        ERROR_MAP.put(7, "用户验证码不正确");
        ERROR_MAP.put(8, "请求头当中没有token");
        ERROR_MAP.put(9, "用户密码格式错误");
        ERROR_MAP.put(10, "用户注册失败");
        ERROR_MAP.put(11, "登录凭证过期请重新登录");
        ERROR_MAP.put(12, "用户登录失败");
    }

    /**
     * 文件类型
     */
    public enum FileType {
        IMAGE,
        VIDEO,
        AUDIO,
        TEXT
    }


    static class EmptyMap extends HashMap<Integer, String> {

        @Override
        public String get(Object key) {
            return null;
        }
    }



    /**
     * 分享信息类型
     */
    public static class ShareType {
        /**
         * 用户分享
         */
        public static final int USER_SHARE = 0;
        /**
         * 活动分享
         */
        public static final int ACTIVITY_SHARE = 1;
        /**
         * 优惠劵分享
         */
        public static final int COUPON_SHARE = 2;
    }



    /**
     * 支付类型
     */
    public static class PaymentType {
        /**
         * 钱包余额支付
         */
        public static final int PAYMENT_TYPE_PPPAY = 0;
        /**
         * 支付宝支付
         */
        public static final int PAYMENT_TYPE_ALIPAY = 1;
        /**
         * 微信支付
         */
        public static final int PAYMENT_TYPE_WECHAT = 2;
        /**
         * 中国银行支付
         */
        public static final int PAYMENT_TYPE_BOC = -1;
        /**
         * 线下POS支付
         */
        public static final int PAYMENT_TYPE_POS = 30;
        /**
         * 代理微信支付
         */
        public static final int PAYMEN_TYPE_PROXY_WECHAT = 24;
    }


    /** JPush连接状态 */
    public static boolean JPushConnectionStatus = false;

    /**
     * 图片大图url类型
     */
    // 本地图片
    public static int IMAGE_TYPE_LOCAL = 0;
    // 网络图片
    public static int IMAGE_TYPE_NET = 1;
    /**
     * 动态类型
     */
    // 其他人动态
    public static int DYNAMIC_TYPE_OTHERS = 0;
    // 我的动态
    public static int DYNAMIC_TYPE_MINE = 1;

    // 刷新订单
    public static String ACTION_REFRESH_ORDERS = "action.refresh.orders";
    // 设置筛选条件
    public static String ACTION_SET_FILTER = "action.set.filter";

}
